<template>
  <div>
    setup方式子组件接受的值： {{ count }}
    setup方式子组件传递的值：{{ countRef }}
    <el-button @click="add">setupAdd</el-button>
  </div>
</template>
<script>
import { ref } from 'vue'

export default {
  props: {
    count: {
      type: Number,
      default: 0
    }
  },
  emits: ['add'],
  setup (props, { emit }) {
    const countRef = ref(0)
    const add= () => {
      countRef.value++
      emit('add', countRef.value)
    }
    return {
      countRef,
      add,
    }
  }
}

</script>

<style scoped>

</style>
